package testJdk.lambda;

import org.junit.Test;

import java.util.Comparator;
import java.util.TreeSet;

/**
 * @ClassName : learn_jdk.lambda.TestLambda
 * @Description : 类描述
 * Created by cyd on 2021-03-31 22:38:38
 */
public class TestLambda {
    @Test
    public void test01() {
        Comparator<Integer> comparator = new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return Integer.compare(o1, o2);
            }
        };
        TreeSet<Integer> treeSet = new TreeSet<>(comparator);
    }

    @Test
    public void test02() {
        TreeSet<Integer> treeSet = new TreeSet<>((x, y) -> Integer.compare(x, y));
    }

    @Test
    public void test03() {
        TreeSet<Integer> treeSet = new TreeSet<>(Integer::compare);
    }
}
